package game.soccerField.lines;

import game.ball.SoccerBall;

public class SouthLateralLine extends LimitLine {

	public SouthLateralLine(double x, double y, int width, int height) {
		super(x, y, width, height);
	}

	@Override
	public void execute() {
		SoccerBall ball = this.getScene().getSoccerBall();
		ball.getLastTouched().throwOutTheBall();
		if(ball.getLastTouched().isUserMate())
			this.getScene().announceOppSouthThrowIn(ball.getX(),this.getYToThrowIn(ball.getAppearance().getHeight()));			
		else
			this.getScene().announceUserSouthThrowIn(ball.getX(),this.getYToThrowIn(ball.getAppearance().getHeight()));
	}
	
	public double getYToThrowIn(double ballHeight){
		return (this.getY()-ballHeight)-10;			
	}
	
}
